using System;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;

namespace SE.HTMLRepeater.Components
{
    public class HTMLRepeaterInfo
    {
        public int ModuleId { get; set; }

        public int ItemId { get; set; }

        public string Content { get; set; }

        public int DisplayOrder { get; set; }

        public string AnchorText { get;set ; }

        public int CreatedByUser { get; set; }

        public DateTime CreatedDate { get; set; }

        private string createdByUserName = null;
        public string CreatedByUserName
        {
            get 
            {
                if (createdByUserName == null)
                {
                    int portalId = PortalController.GetCurrentPortalSettings().PortalId;
                    UserInfo user = UserController.GetUser(portalId, CreatedByUser, false);
                    createdByUserName = user.DisplayName;
                }

                return createdByUserName; 
            }
        }
    }
}
